define(['../../carrys/cityList','../../carrys/jsonList','../../../../js/lib/other/sweet-alert'],function(cityData,jsonList) {
    return ['$scope','$location', '$interval','$timeout','bizProxy', function($scope,$location,$interval,$timeout,bizProxy) {
    	$scope.$emit("top-show",'true');//顶部显示
    	$scope.$emit('menuTypeLight','loan'); 	//控制底部menu高亮
    	$scope.$emit('bub-menu','true'); 	//隐藏底部menu
    	$scope.$emit('flag-tag','63'); 	//显示底部文字
    	
    	$scope.showInvest = false;
    	
    	queryInvestList();
    	function queryInvestList(){
        	var headerInfo = {},bizInfo = {};
        	headerInfo.pageNum = '';
        	headerInfo.pageSize = '';
        	headerInfo.sessionId = transData.sessionId;
        	
        	bizInfo.status = "";
    		$scope.$emit("loadingChange",true);
    		bizProxy.queryProxyBizData("queryNpaApplyList",headerInfo,bizInfo,
    				function(tempData){//SUCCESS
    					$scope.$emit("loadingChange",false);
						$timeout(function(){
							console.log(JSON.stringify(tempData));
							var body = tempData.body;
							if(body != "[]"){
								var infoList = JSON.parse(body);
								if(infoList.length > 0 ){
									$scope.infoList = infoList;
								}else{
									$scope.showInvest = true;
								}
							}else{
								$scope.showInvest = true;
							}
						},100);
		    		},function(data){
		    			if(data != ""){//FAIL
		    				$scope.$emit("loadingChange",false);
							if(data.errorCode == ERROR_CODE.noLogin){
								FIREFLY("", data.errorMsg,"",function(){
										//调用退出登录
										transData.mobileNo = "";
		    							transData.password = "";
		    							transData.sessionId = "";
		    							transData.userType = "";
		    							resultData.loginUserData = "";
		    							resultData.loginResultData = "";
		    							$timeout(function(){
		    								$scope.$emit("goNext","/mine");
		    							},0);
								});
							}else{
								$scope.showInvest = true;
								$scope.$emit("promptAlertMsg",data.errorMsg);
								$scope.$emit("showCollect",true);
								$timeout(function(){
									$scope.$emit("showCollect",false);
								},transData.promptTime);
							}
		    			}else{
		    				$scope.showInvest = true;
		    				$scope.$emit("loadingChange",false);
							$scope.$emit("promptAlertMsg","连接超时");
							$scope.$emit("showCollect",true);
							$timeout(function(){
								$scope.$emit("showCollect",false);
							},transData.promptTime);
		    			}
		    		});
        }
    	
    	//点击进入申请详情
    	$scope.goInvestDetail = function(data){
    		//保存数据
    		bodyInfo.investNplData = data;
    		$scope.$emit("goNext","/nplDetail");
    	}
    	
        $scope.$apply();
    }];
});